//
//  SCTestViewController.swift
//  weibo
//
//  Created by 阿城 on 15/12/5.
//  Copyright © 2015年 阿城. All rights reserved.
//

import UIKit

class SCTestViewController: UITableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "PUSH", target: self, action:"push")
        
    }
    override func viewWillAppear(animated: Bool) {
        setBack()
        
    }
    
    func setBack(){
        
        navigationController?.navigationBar.tintColor = UIColor.blackColor()
        navigationController?.navigationBar.backIndicatorImage = UIImage(named: "navigationbar_back_withtex")
        navigationController!.navigationBar.backIndicatorTransitionMaskImage = nil
        
        let titleText = "第\(navigationController!.childViewControllers.count)级控制器"
        
        printLog(titleText)
        
        title = titleText
        
        let back = UIBarButtonItem(title: "返回", style: UIBarButtonItemStyle.Plain, target: nil, action: "")
        
        //navigationController?.navigationBar.tintColor = UIColor.orangeColor()
        //ss.setTitleTextAttributes([NSFontAttributeName:UIFont. systemFontOfSize(10)], forState: .Normal)
        navigationItem.backBarButtonItem = back
    }
    
    @objc private func push(){
        printLog("push")
        let vc = SCTestViewController()
//        printLog(navigationItem.backBarButtonItem)
        vc.view.backgroundColor = SCColor.getRadomColor()
        navigationController?.pushViewController(vc, animated: true)
    }

}
